package com.airnewslinkosky.ticket.net.type;

import java.util.List;

import com.airnewslinkosky.ticket.model.OfficeInfo;

public class RequestOfficeInfo {
	/** AS编码 */
	public String asID;
	/** 用户优先级别 */
	public String asPriority;
	/** 时间戳，当前接口调用时间 */
	public String timeStamp;
	/** 登录密码 */
	public String userSign;
	/** 授权码 */
	public String officeSign;
	/** 操作类型 */
	public String serviceType;
	/** asToken */
	public String asToken;
	
	/** 商户编号 */
	public String officeID = "";
	/** 商户名称 */
	public String officeName = "";
	/** 商户管理员用户名 */
	public String adminName = "";
	
	public String getRequestData(List<OfficeInfo> officeInfoList) {
		StringBuffer sb = new StringBuffer();
		sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>")
		  .append("<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:asbc='http://asbc.airnews.com/'>")
		  .append("<soapenv:Header/>")
		  .append("<soapenv:Body>")
		  .append("<asbc:OfficeManage>")
		  .append("<asbc:ASID>").append(this.asID).append("</asbc:ASID>")
		  .append("<asbc:TimeStamp>").append(this.timeStamp).append("</asbc:TimeStamp>")
		  .append("<asbc:OfficeSign>").append(this.officeSign).append("</asbc:OfficeSign>")
		  .append("<asbc:UserSign>").append(this.userSign).append("</asbc:UserSign>")
		  .append("<asbc:ASToken>").append(this.asToken).append("</asbc:ASToken>")
		  .append("<asbc:OfficeID>").append(this.officeID).append("</asbc:OfficeID>")
		  .append("<asbc:OfficeName>").append(this.officeName).append("</asbc:OfficeName>")
		  .append("<asbc:AdminName>").append(this.adminName).append("</asbc:AdminName>")
		  .append("<asbc:OperateType>").append(this.serviceType).append("</asbc:OperateType>")
		  .append("<asbc:OfficeInfos>");
		  for(OfficeInfo officeInfo:officeInfoList){
			  sb.append("<asbc:OfficeInfo>")
			    .append("<asbc:OfficeID>").append(officeInfo.OfficeID).append("</asbc:OfficeID>")
//			    .append("<ParentOfficeID>").append(officeInfo.getParentOfficeID()).append("</ParentOfficeID>")
//			    .append("<PlatformNo>").append(officeInfo.getPlatformNO()).append("</PlatformNo>")
//			    .append("<OfficeKey>").append(officeInfo.getOfficeKey()).append("</OfficeKey>")
//			    .append("<OfficeIVS>").append(officeInfo.getOfficeIVS()).append("</OfficeIVS>")
			    .append("<asbc:ProfitAccount>").append(officeInfo.ProfitAccount).append("</asbc:ProfitAccount>")
			    .append("<asbc:Email>").append(officeInfo.Email).append("</asbc:Email>")
			    .append("<asbc:OfficeName>").append(officeInfo.OfficeName).append("</asbc:OfficeName>")
			    .append("<asbc:ContactName>").append(officeInfo.ContactName).append("</asbc:ContactName>")
			    .append("<asbc:Telephone>").append(officeInfo.Telephone).append("</asbc:Telephone>")
			    .append("<asbc:Mobile>").append(officeInfo.Mobile).append("</asbc:Mobile>")
			    .append("<asbc:Fax>").append(officeInfo.Fax).append("</asbc:Fax>")
			    .append("<asbc:OfficeAddress>").append(officeInfo.OfficeAddress).append("</asbc:OfficeAddress>")
			    .append("<asbc:ZIP>").append(officeInfo.ZIP).append("</asbc:ZIP>")
			    .append("<asbc:OfficeDescription>").append(officeInfo.OfficeDescription).append("</asbc:OfficeDescription>")
			    .append("<OfficeState>").append(officeInfo.OfficeState).append("</OfficeState>")
			    .append("<asbc:AllowAgent>").append(officeInfo.AllowAgent).append("</asbc:AllowAgent>")
//			    .append("<asbc:Remark>").append(officeInfo.Remark).append("</asbc:Remark>")
//			    .append("<asbc:UserName>").append(officeInfo.Username).append("</asbc:UserName>")
//			    .append("<asbc:Password>").append(officeInfo.Password).append("</asbc:Password>")
//			    .append("<AuthorityModeNO>").append(officeInfo.getAuthorityModeNO()).append("</AuthorityModeNO>")
//			    .append("<CreateTime>").append(officeInfo.getCreateTime()).append("</CreateTime>")
			    .append("</asbc:OfficeInfo>");
		  }
		  sb.append("</asbc:OfficeInfos>")
		    .append("</asbc:OfficeManage>")
		    .append("</soapenv:Body>")
		    .append("</soapenv:Envelope>");
		return sb.toString();
	}
}
